package jroguelike.main;

/**
 * Created by IntelliJ IDEA.
 * User: aimozg
 * Date: 26.07.11
 * Time: 13:01
 */
public abstract class ArtificialIntelligence {
	protected Creature me;

	public ArtificialIntelligence attach(Creature other) {
		if (me != null) me.ai = null;
		other.ai = this;
		me = other;
		return this;
	}

	public abstract void perform();

	/**
	 * Copy properties to AI {@code other}. Should call {@code super.cloneTo(other)}
	 */
	protected void cloneTo(ArtificialIntelligence other) {
	}

	public abstract ArtificialIntelligence makeClone(Creature newMe);

	public ArtificialIntelligence(Creature me) {
		this.me = me;
	}

	public ArtificialIntelligence() {
	}
}
